package com.yc.pay.api.resp;

import lombok.Data;

@Data
public class RespVo<T> {

    private int code;

    private String msg;

    private T data;

    /**
     * 失败返回对象
     * @param msg
     * @return
     */
    public static RespVo returnFailRespVo(String msg){

        RespVo respVo = new RespVo();
        respVo.setCode(-1);
        respVo.setMsg(msg);
        return respVo;

    }

    /**
     * 成功返回对象
     * @return
     */
    public static RespVo returnSuccessRespVo(Object data){

        RespVo respVo = new RespVo();
        respVo.setCode(0);
        respVo.setMsg("请求成功");
        respVo.setData(data);
        return respVo;

    }
}
